#define DEBUG
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

const int maxn=200000, mods=1000000007, maxk=10;

ll c[maxk+1][maxk+1];

void initC(int n) {
  for (int i=0; i<=n; i++) {
    c[i][0] = 1;
    for (int j=1; j<=i; j++) {
      c[i][j] = c[i-1][j-1]+c[i-1][j];
    }
  }
}

class Segment {
public:
  int l, r;

  static bool cmp(Segment &a, Segment &b) {
    return a.l<b.l;
  }
};

class SegmentTree {
public:
  ll v[4*maxn+5][maxk+1], mark[4*maxn+5];

  void markDown(int o, int l, int r) {
    if (mark[o]!=1) {
      if (l!=r) {
        mark[o*2] = mark[o]*mark[o*2]%mods;
        mark[o*2+1] = mark[o]*mark[o*2+1]%mods;
      }
      for (int i=0; i<=maxk; i++) {
        v[o][i]  = v[o][i]*mark[o]%mods;
      }
      mark[o] = 1;
    }
  }

  void add(int o, int l, int r, int t, int tk, ll tv) {
    markDown(o, l, r);
    v[o][tk]=(v[o][tk]+tv)%mods;
    if (l!=r) {
      int mid=(l+r)/2;
      if (t<=mid) {
        add(o*2, l, mid, t, tk, tv);
      } else {
        add(o*2+1, mid+1, r, t, tk, tv);
      }
    }
  }

  void mul(int o, int l, int r, int tl, int tr, ll tv) {
    markDown(o, l, r);
    if (l==tl && r==tr) {
      mark[o] = mark[o]*tv;
      markDown(o, l, r);
    } else {
      int mid=(l+r)/2;
      if (tl<=mid) {
        mul(o*2, l, mid, max(tl, l), min(tr, mid), tv);
      } else {
        markDown(o*2, l, mid);
      }
      if (tr>mid) {
        mul(o*2+1, mid+1, r, max(tl, mid+1), min(tr, r), tv);
      } else {
        markDown(o*2+1, mid+1, r);
      }
      for (int i=0; i<=maxk; i++) {
        v[o][i] = (v[o*2][i]+v[o*2+1][i])%mods;
      }
    }
  }

  ll get(int o, int l, int r, int tl, int tr, int tk) {
    markDown(o, l, r);
    if (l==tl && r==tr) {
      return v[o][tk];
    } else {
      int mid=(l+r)/2;
      ll ret=0;
      if (tl<=mid) {
        ret = (ret+get(o*2, l, mid, max(tl, l), min(tr, mid), tk))%mods;
      }
      if (tr>mid) {
        ret = (ret+get(o*2+1, mid+1, r, max(tl, mid+1), min(tr, r), tk))%mods;
      }
      return ret;
    }
  }
};

int main() {
  freopen("help.in", "r", stdin);
  freopen("help.out", "w", stdout);

  static Segment sg[maxn+1];
  int n, k;
  scanf("%d %d", &n, &k);
  initC(10);
  for (int i=1; i<=n; i++) {
    scanf("%d %d", &sg[i].l, &sg[i].r);
    sg[i].r--;
  }
  sort(sg+1, sg+n+1, Segment::cmp);

  static SegmentTree sgt;
  sgt.add(1, 0, 2*n, 0, 0, 1);
  for (int i=1; i<=n; i++) {
    static ll val[maxk+1];
    for (int j=0; j<=maxk; j++) {
      sgt.add(1, 0, 2*n, sg[i].r, j, sgt.get(1, 0, 2*n, sg[i].l, sg[i].r, j));
      val[j] = sgt.get(1, 0, 2*n, 0, sg[i].l-1, j);
    }
    for (int j=0; j<=maxk; j++) {
      ll sum=0;
      for (int k=0; k<=j; k++) {
        sum = (val[k]*c[j][k]%mods+sum)%mods;
      }
      sgt.add(1, 0, 2*n, sg[i].r, j, sum);
    }
    sgt.mul(1, 0, 2*n, sg[i].r+1, 2*n, 2);
  }

  printf("%lld", sgt.get(1, 0, 2*n, 0, 2*n, k));

  fclose(stdin);
  fclose(stdout);
  return 0;
}
